package com.Register.mapper;

import com.Register.dto.UserExportDTO;
import com.Register.entity.WxUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface WxUserMapper extends BaseMapper<WxUser> {
    @Select("select * from wx_user where openid = #{openid}")
    WxUser selectByOpenid(@Param("openid") String openid);

    @Select("select name,phone,organization from wx_user where id=#{id} and deleted=0")
    UserExportDTO selectExportDTOById(@Param("id") Long id);

    @Update("update wx_user set deleted=0 where id=#{id}")
    void setUserActive(@Param("id") Long id);

    @Select("select * from wx_user where  deleted=1")
    List<WxUser> selectUserIsDeleted();
}
